package com.hp.bon.sgw.stdbss30;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alipay.api.internal.util.StringUtils;
import com.hp.bon.sgw.stdbss30.common.BizConsts;
import com.hp.bon.sgw.stdbss30.common.BizParam;
import com.hp.bon.sgw.wh.service.UserResourceConfigService;

public class OutApiConfigLoader {

    private static final Logger _log = LoggerFactory.getLogger(OutApiConfigLoader.class);

    public BizParam doLoader(BizParam bizParam) {

        String capability = bizParam.getParamString(BizConsts.KEY_API_CAPABILITY);

        String configKey = null;
        if ("QueryBalance.jf3".equals(capability)) {
            configKey = capability;
        } else if ("BillQueryOwe.jf3".equals(capability)) {
            configKey = capability;
        } else if ("RealFeeQuery.jf3".equals(capability)) {
            configKey = capability;
        } else if ("Recharged.jf3".equals(capability)) {
            configKey = capability;
        } else if ("RechargeRollback.jf3".equals(capability)) {
            configKey = capability;
        } else if ("RechargeQuery.jf3".equals(capability)) {
            configKey = capability;
        } else if ("OperSerialQuery.jf3".equals(capability)) {
            configKey = capability;
        } else if ("PaymentRecordQuery.jf3".equals(capability)) {
            configKey = capability;
        } else if ("CommonDynQuery.jf3".equals(capability)) {
            configKey = capability;
        } else if ("ReturnBalance.jf3".equals(capability)) {
            configKey = capability;
        } else if ("ReturnBalanceDetail.jf3".equals(capability)) {
            configKey = capability;
        } else if ("BalanceRecord.jf3".equals(capability)) {
            configKey = capability;
        } else if ("BalanceRecordDetail.jf3".equals(capability)) {
            configKey = capability;
        } else if ("DayCardUnBlock.jf3".equals(capability)) {
            configKey = capability;
        } else if ("CreditQuery.jf3".equals(capability)) {
            configKey = capability;
        } else if ("CreditGive.jf3".equals(capability)) {
            configKey = capability;
        } else if ("ServAuth.jf3".equals(capability)) {
            configKey = capability;
        } else if ("EmergencyBoot.jf3".equals(capability)) {
            configKey = capability;
        } else if ("QueryHomeAreaByAccNbr.HSS".equals(capability)) {
            configKey = capability;
        } else if ("QueryServ.HSS".equals(capability)) {
            configKey = capability;
        } else if ("CommonDynQuery.HB".equals(capability)) {
            configKey = capability;
        } else if ("DayCardUnBlock.HB".equals(capability)) {
            configKey = capability;
        } else if ("DayCardUnBlock.WH".equals(capability)) {
            configKey = capability;
        } else if ("Query.CreditYXHB9".equals(capability)) {
            configKey = capability;
        } else if ("ReturnBalance.balanceYXHB9".equals(capability)) {
            configKey = capability;
        } else if ("ReturnBalanceDetail.balanceYXHB9".equals(capability)) {
            configKey = capability;
        } else if ("QryBalOwe.Bal".equals(capability)) {
            configKey = capability;
        } else if ("BillDetailQuery.BillYXHB9".equals(capability)) {
            configKey = capability;
        } else if ("NormalPay.Payment".equals(capability)) {
            configKey = "Recharged.jf3";
        }

        String accountApiUrl = UserResourceConfigService.getValue(configKey);
        if (StringUtils.isEmpty(accountApiUrl)) {
            _log.error("none accountApiUrl of {}", configKey);
        } else {
            bizParam.setParam(BizConsts.KEY_ACCOUNT_API_URL, accountApiUrl);
        }

        return bizParam;
    }

}
